Windows Question: RunOnce/Second Boot Issues [closed]

Posted by Greg on Stack Overflow See other posts from Stack Overflow or by Greg
Published on 2010-12-28T00:17:39Z Indexed on 2010/12/28 14:54 UTC
Read the original article Hit count: 279

Moved to Super User:

Windows Question: RunOnce/Second Boot Issues

I am attempting to create a Windows XP SP3 image that will run my application on Second Boot. Here is the intended workflow.

1) Run Image Prep Utility (I wrote) on windows to add my runonce entries and clean a few things up.
2) Reboot to ghost, make image file.
3) Package into my ISO and distribute.
4) System will be imaged by user.
5) On first boot, I have about 5 things that run, one of which includes a driver updater (I wrote) for my own specific devices.
6) One of the entries inside of HKCU/../runonce is a reg file, which adds another key to HKLM/../runonce. This is how second boot is acquired.
7) As a result of the driver updater, user is prompted to reboot.
8) My application is then launched from HKLM/../runonce on second boot.

This workflow works perfectly, except for a select few legacy systems that contain devices that cause the add hardware wizard to pop up. When the add hardware wizard pops up is when I begin to see problems. It's important to note, that if I manually inspect the registry after the add hardware wizard pops up, it appears as I would expect, with all the first boot scripts having run, and it's sitting in a state I would correctly expect it to be in for a second boot scenario.

The problem comes when I click next on the add hardware wizard, it seems to re-run the single entry I've added, and re-executes the runonce scripts. (only one script now as it's already executed and cleared out the initial entries). This causes my application to open as if it were a second boot, only when next is clicked on the add hardware wizard. If I click cancel, and reboot, then it also works as expected.

I don't care as much about other solutions, because I could design a system that doesn't fully rely on Microsoft's registry. I simply can't find any information as to WHY this is happening. I believe this is some type of Microsoft issue that's presenting itself as a result of an overstretched image that's expected to support too many legacy platforms, but any help that can be provided would be appreciated.

Thanks,

© Stack Overflow or respective owner

Related posts about Windows

Related posts about image